package com.agile.leetcode.listandarrayconvert;

/**
 * 三目表达式的类型问题
 *
 * @Author:ChenZhangKun
 * @Date: 2021/11/15 10:00
 */
public class ThreeExpression {
    public static void main(String[] args) {
        test_1();
        test_2();
    }

    public static void test_1() {
        Integer i = null;
        int result = 1 == 1 ? 0 : i;
        System.out.println(result);
    }

    public static void test_2() {
        Integer i = null;
        // 这里是会自动拆箱 i->i.intValue()所以会发送空指针异常
        int result = 1 != 1 ? 0 : i;
        System.out.println(result);
    }
}
